// 使用集合的方法
class Solution {
    public boolean isStraight(int[] nums) {
        Set<Integer> set = new HashSet<>();
        int max = -1 , min = 50;
        for(int num : nums){
            if(num == 0) continue;
            if(set.contains(num)) return false;
            set.add(num);
            min = Math.min(num,min);
            max = Math.max(num,max);
        }
        return max - min < 5;
    }
}

// 排序的方法
class Solution {
    public boolean isStraight(int[] nums) {
        int joker = 0;
        Arrays.sort(nums);
        for(int i = 0; i < 4; i++){
            if(nums[i] == 0) joker++;
            else if(nums[i] == nums[i+1]) return false;
        }
        return nums[4] - nums[joker] < 5;
    }
}